package com.session01;

public class EnumDemo1 {
    public static void main(String[] args) {
        //name()                 Enum
        //ordinal()             获取序号
        //values()              编译器自动加
        //valueOf(String)       编译器自动加
        System.out.println(Season.SPRING);

        //循环遍历
        for (Season season : Season.values()) {
            System.out.print(season.name() + " ");
        }
        System.out.println("");
        System.out.println(Season.valueOf("SPRING"));


        Season season = Season.SPRING;
        System.out.println(season.ordinal());
        System.out.println(season.name());
        System.out.println(season.compareTo(Season.WINTER));
        System.out.println(season.equals(Season.SPRING));
        System.out.println(season.valueOf("SPRING"));
        System.out.println(season.values());


        System.out.println(Season.SPRING.getDesc() + Season.SPRING.getMsg());
    }
}

enum Season {
    SPRING("春天", "可以浪"),
    SUMMER("夏天", "少穿点"),
    AUTUMN("秋天", "吃水果"),
    WINTER("冬天", "滑雪");

    private String desc;
    private String msg;

    public String getMsg() {
        return msg;
    }

    public String getDesc() {
        return desc;
    }

    private Season(String desc, String msg) {
        this.desc = desc;
        this.msg = msg;
    }
}
